package cc.xpcas.raft.network;

import cc.xpcas.raft.codec.Codec;

/**
 * @author xp
 */
public interface Endpoint<ADDRESS extends Address> {

    boolean openSender(ADDRESS address, Codec codec);

    void closeSender();

    boolean isSendable();

    boolean openReceiver(ADDRESS address, Codec codec);

    void closeReceiver();

    boolean isReceivable();

    void send(Packet packet);

    Packet receive();
}
